/*
 * @Descripttion: 程序入口
 * @Version: 1.0
 * @Author: undead
 * @Date: 2022-01-12 15:17:16
 * @LastEditors: undead
 * @LastEditTime: 2022-01-13 11:16:17
 */
const utils = require("./utils");
const config = require("./config");
const decrypt = require("./babel");
const generator = require("@babel/generator").default;

const html = utils.readFileSync(config.file2decrypt);
const ast_body = decrypt(html);
// 代码生成
var { code } = generator(ast_body, {
  jsescOption: {
    minimal: true, // 自动转义
  },
});
utils.saveFileSync(config.file2generate, code);
console.log("转换完成");
